public class Restaurant implements Runnable {
    private Waiter waiter;
    public void setWaiter(Waiter waiter){
        this.waiter = waiter;
    }

    @Override
    public void run(){
        while (true){
            try{
                System.out.println("饭店等待客户++++++++++++");
                Thread.sleep(300);
                String dno = "d"+System.currentTimeMillis();
                Orders orders = new Orders();
                orders.setDno(dno);
                orders.setInfo("来一份鱼香肉丝+++++++");
                System.out.println("客户来了，通知waiter点菜，下单："+dno);
                synchronized (waiter){
                    waiter.setOrders(orders);
                    waiter.setMsgID(1);
                    waiter.notify();
                }
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }

    }
}
